現在開始來講用python開發網頁,
這一篇到後面幾篇來講講用Django 架設一個用markdown寫作的部落格。
也藉著這個範例來說明一下django.
首先,當然是要先安裝好django啦!
pip install django
然後要創建一個django的專案請使用
django-admin startproject {專案名稱}
#我這裡就是專案名稱為blog
django-admin startproject blog
你的資料夾結構如下
blog
├── blog
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── manage.py
接下來到blog的資料夾(或者你專案的資料夾下),使用
python manage.py runserver
接下來會出現一個網址,像我的訊息就是
Performing system checks...
System check identified no issues (0 silenced).
You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
October 24, 2018 - 14:12:00
Django version 2.1.2, using settings 'blog.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
接下來你只要在瀏覽器key上http://127.0.0.1:8000/ 就看到django的初始頁啦
接下來我們一起好好研究Django吧!